package com.kerberos;

import com.kerberos.R;

import android.app.AlertDialog;
import android.app.Dialog;
//import android.app.DialogFragment;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.support.v4.view.PagerAdapter;

public class alerta_borrado_plc extends DialogFragment {
	String mtexto;

	alerta_borrado_plc() {
		}

	@Override
	public Dialog onCreateDialog(Bundle savedInstanceState) {
		// Use the Builder class for convenient dialog construction
		AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
		// builder.setMessage(R.string.alerta_plc+"  "+mtexto)
		mtexto = getResources().getString(R.string.alerta_borrado_plc) + "  " + mtexto;
		builder.setMessage(mtexto).setPositiveButton(R.string.aceptar,
				new DialogInterface.OnClickListener() {
					public void onClick(DialogInterface dialog, int id) {						
						servidor.plcs.remove(MainActivity.pagina);
						xml.generarServidor();
						xml.escribirXml(MainActivity.ctx);
						PagerAdapter aa = MainActivity.mViewPager.getAdapter();
						aa.notifyDataSetChanged();
					}
				});
		builder.setNegativeButton(R.string.cancelar,
				new DialogInterface.OnClickListener() {
			public void onClick(DialogInterface dialog, int id) {
				alerta_borrado_plc.this.getDialog().cancel();
			}
		});
		return builder.create();
	}
}
